package com.haixiaoke.flat.ad.controller;

import com.haixiaoke.saas.ad.domain.ApartmentAd;
import com.haixiaoke.saas.ad.service.IApartmentAdService;
import com.haixiaoke.saas.common.core.domain.AjaxResult;
import com.haixiaoke.saas.common.core.page.TableDataInfo;
import com.haixiaoke.saas.system.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 公寓广告Controller
 *
 * @author qixi
 * @date 2024-04-26
 */
@RestController
@RequestMapping("/front/ad/apartment")
public class FrontApartmentAdController extends BaseController {
    @Autowired
    private IApartmentAdService apartmentAdService;

    /**
     * 查询公寓广告列表
     */
    @GetMapping("/list")
    public AjaxResult list(ApartmentAd apartmentAd) {
        List<ApartmentAd> list = apartmentAdService.selectFrontApartmentAdList(apartmentAd);
        return success(list);
    }

    /**
     * 获取公寓广告详细信息
     */
    @GetMapping(value = "/{bannerId}")
    public AjaxResult getInfo(@PathVariable("bannerId") Long bannerId) {
        return success(apartmentAdService.selectApartmentAdByBannerId(bannerId));
    }
}
